package me.promotion.elasticsearch.controller;

import me.promotion.elasticsearch.service.PositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.util.List;
import java.util.Map;

@Controller
public class PositionController {

    @Autowired
    private PositionService positionService;

    @GetMapping("/search")
    @ResponseBody
    public List<Map<String,Object>> searchPosition(@RequestParam("keyword") String  keyword,
                                                   @RequestParam("queryName") String  queryName,
                                                   @RequestParam("pageNo")int pageNo,
                                                   @RequestParam("pageSize")int  pageSize)throws IOException {
        List<Map<String,Object>> list = positionService.searchPos(keyword, queryName, pageNo, pageSize);
        return  list;
    }
}
